From 8676593f3657c1f7706e4ad33cf1e893de168cf7 Mon Sep 17 00:00:00 2001 From: "emellor@leeni.uk.xensource.com" Date: Wed, 16 Nov 2005 15:27:59 +0100 Subject: [PATCH] Added an unwatch method, so that XendDomainInfo can unregister the watch from outside the watch handler. Signed-off-by: Ewan Mellor --- tools/python/xen/xend/xenstore/xswatch.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/python/xen/xend/xenstore/xswatch.py b/tools/python/xen/xend/xenstore/xswatch.py index fbf165c019..0f8b60d8b8 100644 --- a/tools/python/xen/xend/xenstore/xswatch.py +++ b/tools/python/xen/xend/xenstore/xswatch.py @@ -22,6 +22,10 @@ class xswatch: xs.watch(path, self) + def unwatch(self): + xs.unwatch(self.path, self) + + watchThread = None xs = None xslock = threading.Lock() @@ -49,7 +53,7 @@ def watchMain(): watch = we[1] res = watch.fn(*watch.args, **watch.kwargs) if not res: - xs.unwatch(watch.path, watch) + watch.unwatch() except: log.exception("read_watch failed") # Ignore this exception -- there's no point throwing it -- 2.30.2